#include "comm.h"
int main()
{
    int pipeFd = open(IPC_PATH, O_WRONLY);
    if (pipeFd < 0)
    {
        cout << "open fifo~" << endl;
        return 1;
    }
    char buffer[1024];
    while (true)
    {
        printf("请输入你的消息#");
        fflush(stdout);
        memset(buffer, 0, sizeof(buffer));
        if (fgets(buffer, sizeof(buffer), stdin) != nullptr)
        {
            buffer[strlen(buffer) - 1] = '\0';
            write(pipeFd, buffer, strlen(buffer));
        }
        else
        {
            break;
        }
    }
    close(pipeFd);
    cout<<"客户端退出啦"<<endl;
    return 0;
}